package com.example.server.controller;

import com.example.server.entity.User;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: 默苍璃
 * @date: 2022-03-03 10:54
 */

@RestController
public class ServerController {

    /**
     * 提供get服务
     *
     * @return
     */
    @GetMapping("/serverGet")
    public Map<String, String> serverGet() {
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("name", "小明");
        hashMap.put("age", "18");
        return hashMap;
    }


    /**
     * 提供post服务
     *
     * @return
     */
    @PostMapping("/serverPost")
    public User serverPost(User user) {
        return user;
    }


    /**
     * 提供post服务 body传参
     *
     * @return
     */
    @PostMapping("/serverPostBody")
    public User serverPostBody(@RequestBody User user) {
        return user;
    }


}
